//
//  BaseNavViewController.swift
//  SinaWeibo
//
//  Created by gaoliang on 15/11/16.
//  Copyright © 2015年 gaoliang. All rights reserved.
//

import UIKit

class BaseNavViewController: UINavigationController {
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        if self.childViewControllers.count != 0 {
            viewController.navigationItem.backBarButtonItem =  UIBarButtonItem(title: "返回", style: .Plain, target: self, action: "back")
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: true)
    }
  
       @objc private func back() {
        navigationController?.popViewControllerAnimated(true)
    }
}
